module aes_sbox(
    output      [15:0][255:0]   sbox,
    output      [15:0][255:0]   de_sbox
);


wire    [255:0][7:0]    sbox_c;
wire    [255:0][7:0]    de_sbox_c;

generate
genvar i,j;
    for(i=0;i<16;i++)begin:loop_sbox_i
        for(j=0;j<16;j++)begin:loop_sbox_j
            assign sbox[i][8*j-1-:8] = sbox_c[16*i+j];
            assign de_sbox[i][8*j-1-:8] = de_sbox_c[16*i+j];
        end
    end
endgenerate



assign sbox_c[0  ]=8'h63;
assign sbox_c[1  ]=8'h7c;
assign sbox_c[2  ]=8'h77;
assign sbox_c[3  ]=8'h7b;
assign sbox_c[4  ]=8'hf2;
assign sbox_c[5  ]=8'h6b;
assign sbox_c[6  ]=8'h6f;
assign sbox_c[7  ]=8'hc5;
assign sbox_c[8  ]=8'h30;
assign sbox_c[9  ]=8'h01;
assign sbox_c[10 ]=8'h67;
assign sbox_c[11 ]=8'h2b;
assign sbox_c[12 ]=8'hfe;
assign sbox_c[13 ]=8'hd7;
assign sbox_c[14 ]=8'hab;
assign sbox_c[15 ]=8'h76;
assign sbox_c[16 ]=8'hca;
assign sbox_c[17 ]=8'h82;
assign sbox_c[18 ]=8'hc9;
assign sbox_c[19 ]=8'h7d;
assign sbox_c[20 ]=8'hfa;
assign sbox_c[21 ]=8'h59;
assign sbox_c[22 ]=8'h47;
assign sbox_c[23 ]=8'hf0;
assign sbox_c[24 ]=8'had;
assign sbox_c[25 ]=8'hd4;
assign sbox_c[26 ]=8'ha2;
assign sbox_c[27 ]=8'haf;
assign sbox_c[28 ]=8'h9c;
assign sbox_c[29 ]=8'ha4;
assign sbox_c[30 ]=8'h72;
assign sbox_c[31 ]=8'hc0;
assign sbox_c[32 ]=8'hb7;
assign sbox_c[33 ]=8'hfd;
assign sbox_c[34 ]=8'h93;
assign sbox_c[35 ]=8'h26;
assign sbox_c[36 ]=8'h36;
assign sbox_c[37 ]=8'h3f;
assign sbox_c[38 ]=8'hf7;
assign sbox_c[39 ]=8'hcc;
assign sbox_c[40 ]=8'h34;
assign sbox_c[41 ]=8'ha5;
assign sbox_c[42 ]=8'he5;
assign sbox_c[43 ]=8'hf1;
assign sbox_c[44 ]=8'h71;
assign sbox_c[45 ]=8'hd8;
assign sbox_c[46 ]=8'h31;
assign sbox_c[47 ]=8'h15;
assign sbox_c[48 ]=8'h04;
assign sbox_c[49 ]=8'hc7;
assign sbox_c[50 ]=8'h23;
assign sbox_c[51 ]=8'hc3;
assign sbox_c[52 ]=8'h18;
assign sbox_c[53 ]=8'h96;
assign sbox_c[54 ]=8'h05;
assign sbox_c[55 ]=8'h9a;
assign sbox_c[56 ]=8'h07;
assign sbox_c[57 ]=8'h12;
assign sbox_c[58 ]=8'h80;
assign sbox_c[59 ]=8'he2;
assign sbox_c[60 ]=8'heb;
assign sbox_c[61 ]=8'h27;
assign sbox_c[62 ]=8'hb2;
assign sbox_c[63 ]=8'h75;
assign sbox_c[64 ]=8'h09;
assign sbox_c[65 ]=8'h83;
assign sbox_c[66 ]=8'h2c;
assign sbox_c[67 ]=8'h1a;
assign sbox_c[68 ]=8'h1b;
assign sbox_c[69 ]=8'h6e;
assign sbox_c[70 ]=8'h5a;
assign sbox_c[71 ]=8'ha0;
assign sbox_c[72 ]=8'h52;
assign sbox_c[73 ]=8'h3b;
assign sbox_c[74 ]=8'hd6;
assign sbox_c[75 ]=8'hb3;
assign sbox_c[76 ]=8'h29;
assign sbox_c[77 ]=8'he3;
assign sbox_c[78 ]=8'h2f;
assign sbox_c[79 ]=8'h84;
assign sbox_c[80 ]=8'h53;
assign sbox_c[81 ]=8'hd1;
assign sbox_c[82 ]=8'h00;
assign sbox_c[83 ]=8'hed;
assign sbox_c[84 ]=8'h20;
assign sbox_c[85 ]=8'hfc;
assign sbox_c[86 ]=8'hb1;
assign sbox_c[87 ]=8'h5b;
assign sbox_c[88 ]=8'h6a;
assign sbox_c[89 ]=8'hcb;
assign sbox_c[90 ]=8'hbe;
assign sbox_c[91 ]=8'h39;
assign sbox_c[92 ]=8'h4a;
assign sbox_c[93 ]=8'h4c;
assign sbox_c[94 ]=8'h58;
assign sbox_c[95 ]=8'hcf;
assign sbox_c[96 ]=8'hd0;
assign sbox_c[97 ]=8'hef;
assign sbox_c[98 ]=8'haa;
assign sbox_c[99 ]=8'hfb;
assign sbox_c[100]=8'h43;
assign sbox_c[101]=8'h4d;
assign sbox_c[102]=8'h33;
assign sbox_c[103]=8'h85;
assign sbox_c[104]=8'h45;
assign sbox_c[105]=8'hf9;
assign sbox_c[106]=8'h02;
assign sbox_c[107]=8'h7f;
assign sbox_c[108]=8'h50;
assign sbox_c[109]=8'h3c;
assign sbox_c[110]=8'h9f;
assign sbox_c[111]=8'ha8;
assign sbox_c[112]=8'h51;
assign sbox_c[113]=8'ha3;
assign sbox_c[114]=8'h40;
assign sbox_c[115]=8'h8f;
assign sbox_c[116]=8'h92;
assign sbox_c[117]=8'h9d;
assign sbox_c[118]=8'h38;
assign sbox_c[119]=8'hf5;
assign sbox_c[120]=8'hbc;
assign sbox_c[121]=8'hb6;
assign sbox_c[122]=8'hda;
assign sbox_c[123]=8'h21;
assign sbox_c[124]=8'h10;
assign sbox_c[125]=8'hff;
assign sbox_c[126]=8'hf3;
assign sbox_c[127]=8'hd2;
assign sbox_c[128]=8'hcd;
assign sbox_c[129]=8'h0c;
assign sbox_c[130]=8'h13;
assign sbox_c[131]=8'hec;
assign sbox_c[132]=8'h5f;
assign sbox_c[133]=8'h97;
assign sbox_c[134]=8'h44;
assign sbox_c[135]=8'h17;
assign sbox_c[136]=8'hc4;
assign sbox_c[137]=8'ha7;
assign sbox_c[138]=8'h7e;
assign sbox_c[139]=8'h3d;
assign sbox_c[140]=8'h64;
assign sbox_c[141]=8'h5d;
assign sbox_c[142]=8'h19;
assign sbox_c[143]=8'h73;
assign sbox_c[144]=8'h60;
assign sbox_c[145]=8'h81;
assign sbox_c[146]=8'h4f;
assign sbox_c[147]=8'hdc;
assign sbox_c[148]=8'h22;
assign sbox_c[149]=8'h2a;
assign sbox_c[150]=8'h90;
assign sbox_c[151]=8'h88;
assign sbox_c[152]=8'h46;
assign sbox_c[153]=8'hee;
assign sbox_c[154]=8'hb8;
assign sbox_c[155]=8'h14;
assign sbox_c[156]=8'hde;
assign sbox_c[157]=8'h5e;
assign sbox_c[158]=8'h0b;
assign sbox_c[159]=8'hdb;
assign sbox_c[160]=8'he0;
assign sbox_c[161]=8'h32;
assign sbox_c[162]=8'h3a;
assign sbox_c[163]=8'h0a;
assign sbox_c[164]=8'h49;
assign sbox_c[165]=8'h06;
assign sbox_c[166]=8'h24;
assign sbox_c[167]=8'h5c;
assign sbox_c[168]=8'hc2;
assign sbox_c[169]=8'hd3;
assign sbox_c[170]=8'hac;
assign sbox_c[171]=8'h62;
assign sbox_c[172]=8'h91;
assign sbox_c[173]=8'h95;
assign sbox_c[174]=8'he4;
assign sbox_c[175]=8'h79;
assign sbox_c[176]=8'he7;
assign sbox_c[177]=8'hc8;
assign sbox_c[178]=8'h37;
assign sbox_c[179]=8'h6d;
assign sbox_c[180]=8'h8d;
assign sbox_c[181]=8'hd5;
assign sbox_c[182]=8'h4e;
assign sbox_c[183]=8'ha9;
assign sbox_c[184]=8'h6c;
assign sbox_c[185]=8'h56;
assign sbox_c[186]=8'hf4;
assign sbox_c[187]=8'hea;
assign sbox_c[188]=8'h65;
assign sbox_c[189]=8'h7a;
assign sbox_c[190]=8'hae;
assign sbox_c[191]=8'h08;
assign sbox_c[192]=8'hba;
assign sbox_c[193]=8'h78;
assign sbox_c[194]=8'h25;
assign sbox_c[195]=8'h2e;
assign sbox_c[196]=8'h1c;
assign sbox_c[197]=8'ha6;
assign sbox_c[198]=8'hb4;
assign sbox_c[199]=8'hc6;
assign sbox_c[200]=8'he8;
assign sbox_c[201]=8'hdd;
assign sbox_c[202]=8'h74;
assign sbox_c[203]=8'h1f;
assign sbox_c[204]=8'h4b;
assign sbox_c[205]=8'hbd;
assign sbox_c[206]=8'h8b;
assign sbox_c[207]=8'h8a;
assign sbox_c[208]=8'h70;
assign sbox_c[209]=8'h3e;
assign sbox_c[210]=8'hb5;
assign sbox_c[211]=8'h66;
assign sbox_c[212]=8'h48;
assign sbox_c[213]=8'h03;
assign sbox_c[214]=8'hf6;
assign sbox_c[215]=8'h0e;
assign sbox_c[216]=8'h61;
assign sbox_c[217]=8'h35;
assign sbox_c[218]=8'h57;
assign sbox_c[219]=8'hb9;
assign sbox_c[220]=8'h86;
assign sbox_c[221]=8'hc1;
assign sbox_c[222]=8'h1d;
assign sbox_c[223]=8'h9e;
assign sbox_c[224]=8'he1;
assign sbox_c[225]=8'hf8;
assign sbox_c[226]=8'h98;
assign sbox_c[227]=8'h11;
assign sbox_c[228]=8'h69;
assign sbox_c[229]=8'hd9;
assign sbox_c[230]=8'h8e;
assign sbox_c[231]=8'h94;
assign sbox_c[232]=8'h9b;
assign sbox_c[233]=8'h1e;
assign sbox_c[234]=8'h87;
assign sbox_c[235]=8'he9;
assign sbox_c[236]=8'hce;
assign sbox_c[237]=8'h55;
assign sbox_c[238]=8'h28;
assign sbox_c[239]=8'hdf;
assign sbox_c[240]=8'h8c;
assign sbox_c[241]=8'ha1;
assign sbox_c[242]=8'h89;
assign sbox_c[243]=8'h0d;
assign sbox_c[244]=8'hbf;
assign sbox_c[245]=8'he6;
assign sbox_c[246]=8'h42;
assign sbox_c[247]=8'h68;
assign sbox_c[248]=8'h41;
assign sbox_c[249]=8'h99;
assign sbox_c[250]=8'h2d;
assign sbox_c[251]=8'h0f;
assign sbox_c[252]=8'hb0;
assign sbox_c[253]=8'h54;
assign sbox_c[254]=8'hbb;
assign sbox_c[255]=8'h16;


assign de_sbox_c[0  ]=8'h52;
assign de_sbox_c[1  ]=8'h09;
assign de_sbox_c[2  ]=8'h6A;
assign de_sbox_c[3  ]=8'hD5;
assign de_sbox_c[4  ]=8'h30;
assign de_sbox_c[5  ]=8'h36;
assign de_sbox_c[6  ]=8'hA5;
assign de_sbox_c[7  ]=8'h38;
assign de_sbox_c[8  ]=8'hBF;
assign de_sbox_c[9  ]=8'h40;
assign de_sbox_c[10 ]=8'hA3;
assign de_sbox_c[11 ]=8'h9E;
assign de_sbox_c[12 ]=8'h81;
assign de_sbox_c[13 ]=8'hF3;
assign de_sbox_c[14 ]=8'hD7;
assign de_sbox_c[15 ]=8'hFB;
assign de_sbox_c[16 ]=8'h7C;
assign de_sbox_c[17 ]=8'hE3;
assign de_sbox_c[18 ]=8'h39;
assign de_sbox_c[19 ]=8'h82;
assign de_sbox_c[20 ]=8'h9B;
assign de_sbox_c[21 ]=8'h2F;
assign de_sbox_c[22 ]=8'hFF;
assign de_sbox_c[23 ]=8'h87;
assign de_sbox_c[24 ]=8'h34;
assign de_sbox_c[25 ]=8'h8E;
assign de_sbox_c[26 ]=8'h43;
assign de_sbox_c[27 ]=8'h44;
assign de_sbox_c[28 ]=8'hC4;
assign de_sbox_c[29 ]=8'hDE;
assign de_sbox_c[30 ]=8'hE9;
assign de_sbox_c[31 ]=8'hCB;
assign de_sbox_c[32 ]=8'h54;
assign de_sbox_c[33 ]=8'h7B;
assign de_sbox_c[34 ]=8'h94;
assign de_sbox_c[35 ]=8'h32;
assign de_sbox_c[36 ]=8'hA6;
assign de_sbox_c[37 ]=8'hC2;
assign de_sbox_c[38 ]=8'h23;
assign de_sbox_c[39 ]=8'h3D;
assign de_sbox_c[40 ]=8'hEE;
assign de_sbox_c[41 ]=8'h4C;
assign de_sbox_c[42 ]=8'h95;
assign de_sbox_c[43 ]=8'h0B;
assign de_sbox_c[44 ]=8'h42;
assign de_sbox_c[45 ]=8'hFA;
assign de_sbox_c[46 ]=8'hC3;
assign de_sbox_c[47 ]=8'h4E;
assign de_sbox_c[48 ]=8'h08;
assign de_sbox_c[49 ]=8'h2E;
assign de_sbox_c[50 ]=8'hA1;
assign de_sbox_c[51 ]=8'h66;
assign de_sbox_c[52 ]=8'h28;
assign de_sbox_c[53 ]=8'hD9;
assign de_sbox_c[54 ]=8'h24;
assign de_sbox_c[55 ]=8'hB2;
assign de_sbox_c[56 ]=8'h76;
assign de_sbox_c[57 ]=8'h5B;
assign de_sbox_c[58 ]=8'hA2;
assign de_sbox_c[59 ]=8'h49;
assign de_sbox_c[60 ]=8'h6D;
assign de_sbox_c[61 ]=8'h8B;
assign de_sbox_c[62 ]=8'hD1;
assign de_sbox_c[63 ]=8'h25;
assign de_sbox_c[64 ]=8'h72;
assign de_sbox_c[65 ]=8'hF8;
assign de_sbox_c[66 ]=8'hF6;
assign de_sbox_c[67 ]=8'h64;
assign de_sbox_c[68 ]=8'h86;
assign de_sbox_c[69 ]=8'h68;
assign de_sbox_c[70 ]=8'h98;
assign de_sbox_c[71 ]=8'h16;
assign de_sbox_c[72 ]=8'hD4;
assign de_sbox_c[73 ]=8'hA4;
assign de_sbox_c[74 ]=8'h5C;
assign de_sbox_c[75 ]=8'hCC;
assign de_sbox_c[76 ]=8'h5D;
assign de_sbox_c[77 ]=8'h65;
assign de_sbox_c[78 ]=8'hB6;
assign de_sbox_c[79 ]=8'h92;
assign de_sbox_c[80 ]=8'h6C;
assign de_sbox_c[81 ]=8'h70;
assign de_sbox_c[82 ]=8'h48;
assign de_sbox_c[83 ]=8'h50;
assign de_sbox_c[84 ]=8'hFD;
assign de_sbox_c[85 ]=8'hED;
assign de_sbox_c[86 ]=8'hB9;
assign de_sbox_c[87 ]=8'hDA;
assign de_sbox_c[88 ]=8'h5E;
assign de_sbox_c[89 ]=8'h15;
assign de_sbox_c[90 ]=8'h46;
assign de_sbox_c[91 ]=8'h57;
assign de_sbox_c[92 ]=8'hA7;
assign de_sbox_c[93 ]=8'h8D;
assign de_sbox_c[94 ]=8'h9D;
assign de_sbox_c[95 ]=8'h84;
assign de_sbox_c[96 ]=8'h90;
assign de_sbox_c[97 ]=8'hD8;
assign de_sbox_c[98 ]=8'hAB;
assign de_sbox_c[99 ]=8'h00;
assign de_sbox_c[100]=8'h8C;
assign de_sbox_c[101]=8'hBC;
assign de_sbox_c[102]=8'hD3;
assign de_sbox_c[103]=8'h0A;
assign de_sbox_c[104]=8'hF7;
assign de_sbox_c[105]=8'hE4;
assign de_sbox_c[106]=8'h58;
assign de_sbox_c[107]=8'h05;
assign de_sbox_c[108]=8'hB8;
assign de_sbox_c[109]=8'hB3;
assign de_sbox_c[110]=8'h45;
assign de_sbox_c[111]=8'h06;
assign de_sbox_c[112]=8'hD0;
assign de_sbox_c[113]=8'h2C;
assign de_sbox_c[114]=8'h1E;
assign de_sbox_c[115]=8'h8F;
assign de_sbox_c[116]=8'hCA;
assign de_sbox_c[117]=8'h3F;
assign de_sbox_c[118]=8'h0F;
assign de_sbox_c[119]=8'h02;
assign de_sbox_c[120]=8'hC1;
assign de_sbox_c[121]=8'hAF;
assign de_sbox_c[122]=8'hBD;
assign de_sbox_c[123]=8'h03;
assign de_sbox_c[124]=8'h01;
assign de_sbox_c[125]=8'h13;
assign de_sbox_c[126]=8'h8A;
assign de_sbox_c[127]=8'h6B;
assign de_sbox_c[128]=8'h3A;
assign de_sbox_c[129]=8'h91;
assign de_sbox_c[130]=8'h11;
assign de_sbox_c[131]=8'h41;
assign de_sbox_c[132]=8'h4F;
assign de_sbox_c[133]=8'h67;
assign de_sbox_c[134]=8'hDC;
assign de_sbox_c[135]=8'hEA;
assign de_sbox_c[136]=8'h97;
assign de_sbox_c[137]=8'hF2;
assign de_sbox_c[138]=8'hCF;
assign de_sbox_c[139]=8'hCE;
assign de_sbox_c[140]=8'hF0;
assign de_sbox_c[141]=8'hB4;
assign de_sbox_c[142]=8'hE6;
assign de_sbox_c[143]=8'h73;
assign de_sbox_c[144]=8'h96;
assign de_sbox_c[145]=8'hAC;
assign de_sbox_c[146]=8'h74;
assign de_sbox_c[147]=8'h22;
assign de_sbox_c[148]=8'hE7;
assign de_sbox_c[149]=8'hAD;
assign de_sbox_c[150]=8'h35;
assign de_sbox_c[151]=8'h85;
assign de_sbox_c[152]=8'hE2;
assign de_sbox_c[153]=8'hF9;
assign de_sbox_c[154]=8'h37;
assign de_sbox_c[155]=8'hE8;
assign de_sbox_c[156]=8'h1C;
assign de_sbox_c[157]=8'h75;
assign de_sbox_c[158]=8'hDF;
assign de_sbox_c[159]=8'h6E;
assign de_sbox_c[160]=8'h47;
assign de_sbox_c[161]=8'hF1;
assign de_sbox_c[162]=8'h1A;
assign de_sbox_c[163]=8'h71;
assign de_sbox_c[164]=8'h1D;
assign de_sbox_c[165]=8'h29;
assign de_sbox_c[166]=8'hC5;
assign de_sbox_c[167]=8'h89;
assign de_sbox_c[168]=8'h6F;
assign de_sbox_c[169]=8'hB7;
assign de_sbox_c[170]=8'h62;
assign de_sbox_c[171]=8'h0E;
assign de_sbox_c[172]=8'hAA;
assign de_sbox_c[173]=8'h18;
assign de_sbox_c[174]=8'hBE;
assign de_sbox_c[175]=8'h1B;
assign de_sbox_c[176]=8'hFC;
assign de_sbox_c[177]=8'h56;
assign de_sbox_c[178]=8'h3E;
assign de_sbox_c[179]=8'h4B;
assign de_sbox_c[180]=8'hC6;
assign de_sbox_c[181]=8'hD2;
assign de_sbox_c[182]=8'h79;
assign de_sbox_c[183]=8'h20;
assign de_sbox_c[184]=8'h9A;
assign de_sbox_c[185]=8'hDB;
assign de_sbox_c[186]=8'hC0;
assign de_sbox_c[187]=8'hFE;
assign de_sbox_c[188]=8'h78;
assign de_sbox_c[189]=8'hCD;
assign de_sbox_c[190]=8'h5A;
assign de_sbox_c[191]=8'hF4;
assign de_sbox_c[192]=8'h1F;
assign de_sbox_c[193]=8'hDD;
assign de_sbox_c[194]=8'hA8;
assign de_sbox_c[195]=8'h33;
assign de_sbox_c[196]=8'h88;
assign de_sbox_c[197]=8'h07;
assign de_sbox_c[198]=8'hC7;
assign de_sbox_c[199]=8'h31;
assign de_sbox_c[200]=8'hB1;
assign de_sbox_c[201]=8'h12;
assign de_sbox_c[202]=8'h10;
assign de_sbox_c[203]=8'h59;
assign de_sbox_c[204]=8'h27;
assign de_sbox_c[205]=8'h80;
assign de_sbox_c[206]=8'hEC;
assign de_sbox_c[207]=8'h5F;
assign de_sbox_c[208]=8'h60;
assign de_sbox_c[209]=8'h51;
assign de_sbox_c[210]=8'h7F;
assign de_sbox_c[211]=8'hA9;
assign de_sbox_c[212]=8'h19;
assign de_sbox_c[213]=8'hB5;
assign de_sbox_c[214]=8'h4A;
assign de_sbox_c[215]=8'h0D;
assign de_sbox_c[216]=8'h2D;
assign de_sbox_c[217]=8'hE5;
assign de_sbox_c[218]=8'h7A;
assign de_sbox_c[219]=8'h9F;
assign de_sbox_c[220]=8'h93;
assign de_sbox_c[221]=8'hC9;
assign de_sbox_c[222]=8'h9C;
assign de_sbox_c[223]=8'hEF;
assign de_sbox_c[224]=8'hA0;
assign de_sbox_c[225]=8'hE0;
assign de_sbox_c[226]=8'h3B;
assign de_sbox_c[227]=8'h4D;
assign de_sbox_c[228]=8'hAE;
assign de_sbox_c[229]=8'h2A;
assign de_sbox_c[230]=8'hF5;
assign de_sbox_c[231]=8'hB0;
assign de_sbox_c[232]=8'hC8;
assign de_sbox_c[233]=8'hEB;
assign de_sbox_c[234]=8'hBB;
assign de_sbox_c[235]=8'h3C;
assign de_sbox_c[236]=8'h83;
assign de_sbox_c[237]=8'h53;
assign de_sbox_c[238]=8'h99;
assign de_sbox_c[239]=8'h61;
assign de_sbox_c[240]=8'h17;
assign de_sbox_c[241]=8'h2B;
assign de_sbox_c[242]=8'h04;
assign de_sbox_c[243]=8'h7E;
assign de_sbox_c[244]=8'hBA;
assign de_sbox_c[245]=8'h77;
assign de_sbox_c[246]=8'hD6;
assign de_sbox_c[247]=8'h26;
assign de_sbox_c[248]=8'hE1;
assign de_sbox_c[249]=8'h69;
assign de_sbox_c[250]=8'h14;
assign de_sbox_c[251]=8'h63;
assign de_sbox_c[252]=8'h55;
assign de_sbox_c[253]=8'h21;
assign de_sbox_c[254]=8'h0C;
assign de_sbox_c[255]=8'h7D;


endmodule

